﻿import mx.utils.Delegate;
class cn.eminia.AS2.HotKey {
	// 只接受下面的值
	var keyS = 'F2|F7|F8|F9|F10';
	var codeS = '113|118|119|120|121';
	var keyArr = [], funcArr = [];
	function HotKey(a) {
		keyArr = [];
		funcArr = [];
		keyS = keyS.split('|');
		codeS = codeS.split('|');
		for (var i = 0; i<keyS.length; i++) {
			if (a[keyS[i]] != null) {
				keyArr.push(codeS[i]);
				funcArr.push(a[keyS[i]]);
			}
		}
		var keyLis = new Object();
		keyLis.onKeyDown = Delegate.create(this, function () {
			for (var i = 0; i<keyArr.length; i++) {
				if (Key.getCode() == keyArr[i]) {
					funcArr[i]();
				}
			}
		});
		Key.addListener(keyLis);
	}
}
